package com.heima.kafka.lister;

import cn.hutool.core.bean.BeanUtil;
import com.heima.kafka.dto.UserDTO;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class KafkaLister {
    @KafkaListener(topics = "itcast_heima")
    public void hello(String msg) {
        System.out.println("consumer get msg " + msg);
    }


    @KafkaListener(topics = "itcast_heima_user")
    public void user(String msg) {
        UserDTO userDto = BeanUtil.toBean(msg, UserDTO.class);

        System.out.println("consumer get msg " + msg);

        System.out.println(userDto);
        System.out.println("-------------");
    }
}
